home *** CD-ROM | disk | FTP | other *** search
/ CD Exchange / CD Exchange - Volume 1.iso / utils / disk / cdfix / readme < prev   
Encoding:
Text File  |  1993-08-14  |  5.6 KB  |  149 lines

  1. This little program fixes two bugs I found in cdtv's file system (cdfs.library)
  2. It only works for cdfs v24 rev 9; it won't do anything if you don't have that
  3. version of cdfs.  It has only been tested on my unaccelerated a500 w/ a570,
  4. v2.0 OS (should work with 1.3, though).  If you have any comments or questions,
  5. I can be reached via internet email as dark@judy.indstate.edu.
  6.  
  7. To run, just type
  8. run >nil: cdfix
  9. on your cdtv or a500 w/ a570 sometime before you insert a disk which would
  10. otherwise make it crash :)
  11.  
  12. -- description of bugs --
  13.  
  14. Problem 1 [direct transcript of my post to comp.sys.amiga.programmer]
  15. As you probably know, the A570 and CDTV have problems reading non-CDTV
  16. ISO-9660 disks [those that I have tried and read by other means are AB20 and
  17. the OS/2 Devel. Kit.  After looking throught the ROM on my A570 over the last
  18. couple of days, I found what I believe to be the problem.  Of course since
  19. it's in ROM, I have no fix as yet, but I just thought I'd let you all know &
  20. see what you think.  The problem is in cdfs (CD0:/cdfs.library), and the
  21. following refers to cdfs 24.9 (22.10.91) @ $f35544.
  22.  
  23. The problem is after $f3654c:
  24.  
  25. $f3654c tst.l    -4(A5)
  26.     bne    $f36558
  27.     move.l    D4,-4(A5)
  28. $36558 ...
  29.  
  30. Which I believe should read:
  31.  
  32. $f3654c    tst.l    -4(A5)
  33.     bne    $f36558
  34.     move.l    D4,D0
  35.     add.l    D6,D0
  36.     move.l    D0,-4(A5)
  37. $36558 [not any more :)] ...
  38.  
  39. Of course fixing the problem in ROM would be relatively easy if I were
  40. inclined to burn my own, since there are plenty of inefficient pieces of
  41. code even immediately surrounding the offensive code that the addition of 4
  42. bytes could be offset, for instance, by making a few bra.w xxx into bra.s
  43. xxx in the near vicinity.
  44.  
  45. To better explain the bug:  The routine @ $F36464 checks the disk for
  46. ISO-9660 descriptors.  In the routine, a buffer is allocated (A3 = "buf")
  47. which contains sectors from the disk.  D4 ("i") keeps track of the number of
  48. the first sector in the buffer, and D6 ("j") keeps track of the offset into
  49. the buffer currently being on.  (D5 ("o") is D6*2048, or the actual
  50. byte-offset into the buffer).  -4(A5) ("vold") stores the volume descriptor
  51. when found.
  52.  
  53. [Note:  all iso struct names are from the "ctools" utility on ftp.cdrom.com]
  54.  
  55. There is a loop similar to:
  56.  
  57. /* irrelevant bs.. */
  58. /* decl buf as struct iso_volume_descriptor *buf */
  59. /* allocate buf = nsecs*2048 bytes; nsecs = 16 or 2 dep. on avail. mem. */
  60. for(i=16;i<256;i+=nsecs) {
  61.     dbprint3("\tp%lx.%lx\n",i,vold);
  62.     readcd(buf,i,nsecs); /* read nsecs sectors starting @ i */
  63.     for(j=0,o=0;j<nsecs;j++) { /* isiso: check for CD001 v1 */
  64.         if(isiso(buf[j])) switch(buf[j].id) {
  65.             case 0:
  66.                 /* irrelevant CDTV stuff */
  67.                 break;
  68.             case ISO_VD_PRIMARY: /* @ $f3654c */
  69.                 if(!vold)
  70.                     vold = i; /* should be vold = i+j; */
  71.                 if(!memcmp(buf[j].data,'CDTV'+spaces,32||..)
  72.                     more irrelevant CDTV stuff;
  73.                 break;
  74.             case ISO_VD_END:
  75.                 j = nsecs;
  76.                 i = 256;
  77.                 break;
  78.         }
  79.     }
  80. }
  81. /* yet more irrelevant bs */
  82.  
  83. Well, there you have it.  Simple error when assigning vold as commented..
  84. Folks at Commodore:  How about either fixing it or telling me why this isn't
  85. a bug?
  86.  
  87.  
  88. Problems 2&3: [again, direct transcript from my post]
  89.  
  90. Well, I finally got around to making a patch which fixed the bug I mentioned
  91. in the previous posting, and discovered several new problems, among which is
  92. the fact that the bug I reported is not the "real" bug [i.e. the one making
  93. cdfs crash].
  94. The problems are as follows:
  95. 1) When cdfs interprets the date, it does the following: [dis output]
  96. RF38632
  97.    movem.l   D2/A2,-(SP)
  98.    move.l    $0C(SP),A2
  99.    move.l    $10(SP),A1
  100.    moveq     #4,D1
  101.    bsr         RF386BA
  102.    tst.w     D0
  103.    beq.s     lF38662
  104.    sub.w     #$076C,D0
  105.    move.b    D0,(A2)+
  106.    moveq     #4,D2
  107. lF38650
  108.    moveq     #2,D1
  109.    bsr         RF386BA
  110.    move.b    D0,(A2)+
  111.    dbra      D2,lF38650(PC)
  112.    clr.b     (A2)+
  113.    movem.l   (SP)+,D2/A2
  114. lF38662
  115.    rts
  116.  
  117. Note that when there is not a valid date, it returns via lF38662, which
  118. should have been moved up one line, and thus causes rts to crash cdfs/the
  119. system...  This is what causes AB20 to crash, as my patch verified after I
  120. fixed this bug.
  121.  
  122. 2) When cdfs reads [via cdtv.device, of course] the disk looking for the
  123.    root node, it keeps track of where it found one [see previous bug
  124.    posting], and continues searching for a CDTV-specific block (boot block?
  125.    31-char filename dir? who knows?).  Then when it doesn't find a
  126.    CDTV-specific block, it re-reads the disk for the previously-tagged root
  127.    block.  This read returns an error of -10 90% of the time on my A570 for
  128.    my two non-CDTV 9660 disks, and is the reason the OS/2 developers' disk
  129.    couldn't be read.  Anybody have any idea what error -10 is, and/or how to
  130.    fix the bug? [the solution I'm attempting at the moment involves just
  131.    copying the sector into the buffer when it finds it rather than
  132.    re-reading it]
  133.  
  134. Ah, well.  If I ever get this horrible patch to install itself directly from
  135. disk instead of only from within the debugger (why?  I haven't a clue - it
  136. doesn't matter if I single-step or not, it just works from within the
  137. debugger - probably due to some messaging conflicts), and to fix that error
  138. -10 bug, maybe I'll upload the patch to aminet or boing... [done]
  139.  
  140. -------------------------
  141.  
  142. I also included cdfs.sym, which is a set of symbols you can use to
  143. disassemble cdfs yourself if you so desire and cdfs is located @ $f35544.
  144.  
  145. -----------------------------------------------------------------------------
  146. Thomas J. Moore, Amiga Programmer | Parallel Processing:  The future of PC's
  147. inet:  dark@judy.indstate.edu     | Must .... Kill .... Bugs.... AAARRRGGHHH
  148. -----------------------------------------------------------------------------
  149.